package leetcode.code1037;

import leetcode.IDebug;

public class Solution implements IDebug {

	public boolean isBoomerang(int[][] points) {
		int a = points[1][0] - points[0][0];
		int b = points[1][1] - points[0][1];
		int c = points[2][0] - points[0][0];
		int d = points[2][1] - points[0][1];
		if ((a == 0 && b == 0) || (c == 0 && d == 0)) {
			return false;
		}
		int gcdab = this.gcd(a, b);
		int gcdcd = this.gcd(c, d);
		if (this.div(a, gcdab) == this.div(c, gcdcd) && this.div(b, gcdab) == this.div(d, gcdcd)) {
			return false;
		}
		return true;
	}

	private int div(int a, int b) {
		return b == 0 ? a : a / b;
	}

	private int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
